POV-Ray : Newsgroups : povray.programming : Vector arithmetic using .t problems : Vector arithmetic using .t problems Server Time
6 Oct 2024 13:48:27 EDT (-0400)
  Vector arithmetic using .t problems  
From: Massimo Valentini
Date: 20 Dec 2002 14:01:02
Message: <3e0368ee$1@news.povray.org>
Bugreport taken from:

http://www.povray.org/download/3.5-bugs.php

in particularly

http://news.povray.org/3c4bb31d$1@news.povray.org

This bugreport is not marked as a job, I thought it was because 
already fixed for the next release, but I see now it's in the 
bottom half of the list. So here's a note:

The problem is that an expression like:

#declare vvv = <1, 0, 0> +1*t;

results in a 4D vector vvv = <1,0,0,0>

this is because 1 is firstly promoted to a 3D vector (<1,1,1>)
as a right hand side of the binary +, and then it is promoted
to a 4D vector (<1,1,1,0>) as a left hand side of the * operator.
Multiplying it by t (<0,0,0,1>) results in a 4D <0,0,0,0> that 
added to <1,0,0> only promotes it to <1,0,0,0>.

Here's a patch that shows a possible solution, but I'm not
certain it's fully correct. (The patch is against express.cpp
of the linux sources version 3.50a)

HTH Massimo

--- src/express.cpp.ex 2002-12-20 19:27:58.000000000 +0000
+++ src/express.cpp 2002-12-20 19:28:15.000000000 +0000
@@ -1582,7 +1582,7 @@
 
    Parse_Num_Term(Express,Terms);
 
-   Local_Terms=*Terms;
+   Local_Terms=1;
 
    EXPECT
      CASE (PLUS_TOKEN)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.